package com.suxin.spring.task;

import lombok.Getter;

import java.time.LocalDateTime;

/**
 * @author Tang
 * @classname AbstractRunnableTask
 * @description [  ]
 * @date 2021/8/1 17:00
 */
public abstract class AbstractRunnableTask implements Runnable{

    @Getter
    private String taskId;

    public AbstractRunnableTask(String taskId) {
        this.taskId = taskId;
    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "-任务开始时间..." + LocalDateTime.now());
        doWork();
        System.out.println(Thread.currentThread().getName() + "-任务结束时间..." + LocalDateTime.now());
    }

    /**
     * 具体工作
     */
    protected abstract void doWork();
}